/* See the files LICENSE and COPYRIGHT for license and copyright information */
package org.rubiq;

import org.rubiq.reader.DefaultReader;

import org.jruby.Ruby;

/**
 * @author <a href="mailto:ola.bini@gmail.com">Ola Bini</a>
 */
public class RubiqREPL {
    public static void main(String[] args) throws Exception {
        java.io.FileReader ff = new java.io.FileReader(args[0]);
        DefaultReader def = new DefaultReader(ff);
        LispExpression val;
        Ruby runtime = Ruby.getDefaultInstance();
        RubiqEvaluator evaluator = new RubiqEvaluator(runtime);
        while((val = def.readNext()) != null) {
            System.out.println("=> " + runtime.eval(evaluator.transform(val)).callMethod(runtime.getCurrentContext(), "inspect"));
        }
        ff.close();
    }
}// RubiqREPL
